From 6a8e563b068b0582dd0b57fbcbaf2497a8deb8b5 Mon Sep 17 00:00:00 2001 From: "kaf24@scramble.cl.cam.ac.uk" Date: Thu, 24 Jun 2004 14:42:34 +0000 Subject: [PATCH] bitkeeper revision 1.1011.1.2 (40dae85aOFSYGQJhY16qVWXzyhadnA) makefile cleanups --- Makefile | 62 ++++++++++++----------- linux-2.4.26-xen-sparse/arch/xen/Makefile | 10 ++-- 2 files changed, 35 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 5ec29e42e3..571d0b23a6 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ INSTALL_DIR ?= $(shell pwd)/install -SOURCEFORGE_MIRROR = http://heanet.dl.sourceforge.net/sourceforge +SOURCEFORGE_MIRROR := http://heanet.dl.sourceforge.net/sourceforge #http://voxel.dl.sourceforge.net/sourceforge/ #http://easynews.dl.sourceforge.net/sourceforge @@ -25,55 +25,57 @@ dist: all $(MAKE) linux-xenU $(MAKE) linux-xen0 -LINUX_VER ?= $(shell ( /bin/ls -ld linux-*-xen-sparse ) 2>/dev/null | sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' ) +LINUX_VER ?= $(shell ( /bin/ls -ld linux-*-xen-sparse ) 2>/dev/null | \ + sed -e 's!^.*linux-\(.\+\)-xen-sparse!\1!' ) LINUX_CONFIG_DIR ?= $(INSTALL_DIR)/boot LINUX_SRC_PATH ?= .:.. -LINUX_SRC_X ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),$(wildcard $(dir)/linux-$(LINUX_VER).tar.*z*))) +LINUX_SRC ?= $(firstword $(foreach dir,$(subst :, ,$(LINUX_SRC_PATH)),\ + $(wildcard $(dir)/linux-$(LINUX_VER).tar.*z*))) # search for a pristine kernel tar ball, or try downloading one pristine-linux-src: -ifneq ($(LINUX_SRC),) - @[ -r "$(LINUX_SRC)" ] || (echo "Can not find linux src at $(LINUX_SRC)" && false) -LINUX_SRC_X = $(LINUX_SRC) -else -ifeq ($(LINUX_SRC_X),) - @echo "Can not find linux-$(LINUX_VER).tar.gz in path $(LINUX_SRC_PATH)" +ifeq ($(LINUX_SRC),) + @echo "Cannot find linux-$(LINUX_VER).tar.gz in path $(LINUX_SRC_PATH)" @wget ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-$(LINUX_VER).tar.bz2 -O./linux-$(LINUX_VER).tar.bz2 -LINUX_SRC_X = ./linux-$(LINUX_VER).tar.bz2 -endif +LINUX_SRC := ./linux-$(LINUX_VER).tar.bz2 endif patches/ebtables-brnf-5_vs_2.4.25.diff: mkdir -p patches - wget $(SOURCEFORGE_MIRROR)/ebtables/ebtables-brnf-5_vs_2.4.25.diff.gz -O- | gunzip -c > $@ + wget $(SOURCEFORGE_MIRROR)/ebtables/ebtables-brnf-5_vs_2.4.25.diff.gz \ + -O- | gunzip -c > $@ -LINUX_TREES = linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU +LINUX_TREES := linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU # make a linux-xen build tree from a pristine kernel plus sparse tree mk-linux-trees: patches/ebtables-brnf-5_vs_2.4.25.diff pristine-linux-src $(RM) -rf $(LINUX_TREES) -ifeq (,$(findstring bz2,$(LINUX_SRC_X))) - tar -zxf $(LINUX_SRC_X) -else - tar -jxf $(LINUX_SRC_X) -endif + echo $(LINUX_SRC) | grep -q bz2 && \ + tar -jxf $(LINUX_SRC) || tar -zxf $(LINUX_SRC) mv linux-$(LINUX_VER) linux-$(LINUX_VER)-xen0 - ( cd linux-$(LINUX_VER)-xen-sparse ; ./mkbuildtree ../linux-$(LINUX_VER)-xen0 ) + ( cd linux-$(LINUX_VER)-xen-sparse ; \ + ./mkbuildtree ../linux-$(LINUX_VER)-xen0 ) cp -al linux-$(LINUX_VER)-xen0 linux-$(LINUX_VER)-xenU - (cd linux-$(LINUX_VER)-xen0 && patch -p1 -F3 < ../patches/ebtables-brnf-5_vs_2.4.25.diff) + ( cd linux-$(LINUX_VER)-xen0 ; \ + patch -p1 -F3 < ../patches/ebtables-brnf-5_vs_2.4.25.diff ) # configure the specified linux tree +CDIR = $(subst config-,linux-$(LINUX_VER)-,$@) config-xen%: - $(MAKE) -C $(subst config-,linux-$(LINUX_VER)-,$(@)) ARCH=xen mrproper - cp $(LINUX_CONFIG_DIR)/config-$(LINUX_VER)-$(subst config-,,$(@)) $(subst config-,linux-$(LINUX_VER)-,$(@))/.config || $(MAKE) -C $(subst config-,linux-$(LINUX_VER)-,$(@)) ARCH=xen $(subst config-,,$(@))_config - $(MAKE) -C $(subst config-,linux-$(LINUX_VER)-,$(@)) ARCH=xen oldconfig - $(MAKE) -C $(subst config-,linux-$(LINUX_VER)-,$(@)) ARCH=xen dep + $(MAKE) -C $(CDIR) ARCH=xen mrproper + cp $(LINUX_CONFIG_DIR)/config-$(LINUX_VER)-$(subst config-,,$@) \ + $(CDIR)/.config || \ + $(MAKE) -C $(CDIR) ARCH=xen $(subst config-,,$@)_config + $(MAKE) -C $(CDIR) ARCH=xen oldconfig + $(MAKE) -C $(CDIR) ARCH=xen dep # build the specified linux tree +BDIR = $(subst linux-,linux-$(LINUX_VER)-,$@) linux-xen%: - $(MAKE) -C $(subst linux-,linux-$(LINUX_VER)-,$(@)) ARCH=xen modules - $(MAKE) -C $(subst linux-,linux-$(LINUX_VER)-,$(@)) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) modules_install - $(MAKE) -C $(subst linux-,linux-$(LINUX_VER)-,$(@)) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install + $(MAKE) -C $(BDIR) ARCH=xen modules + $(MAKE) -C $(BDIR) ARCH=xen INSTALL_MOD_PATH=$(INSTALL_DIR) \ + modules_install + $(MAKE) -C $(BDIR) ARCH=xen INSTALL_PATH=$(INSTALL_DIR) install # build xen, the tools, and a domain 0 plus unprivileged linux-xen images, # and place them in the install directory. 'make install' should then @@ -96,7 +98,6 @@ clean: delete-symlinks mrproper: clean rm -rf install/* patches $(LINUX_TREES) linux-$(LINUX_VER).tar.* - make-symlinks: delete-symlinks ln -sf linux-$(LINUX_VER)-xen-sparse linux-xen-sparse @@ -107,12 +108,13 @@ delete-symlinks: install-twisted: wget http://www.twistedmatrix.com/products/get-current.epy tar -zxf Twisted-*.tar.gz - (cd Twisted-* ; python setup.py install) + ( cd Twisted-* ; python setup.py install ) # handy target to upgrade iptables (use rpm or apt-get in preference) install-iptables: wget http://www.netfilter.org/files/iptables-1.2.11.tar.bz2 tar -jxf iptables-*.tar.bz2 - (cd iptables-* ; make PREFIX= KERNEL_DIR=../linux-$(LINUX_VER)-xen0 install) + ( cd iptables-* ; \ + make PREFIX= KERNEL_DIR=../linux-$(LINUX_VER)-xen0 install) diff --git a/linux-2.4.26-xen-sparse/arch/xen/Makefile b/linux-2.4.26-xen-sparse/arch/xen/Makefile index 8825bcfe96..44fe201bc5 100644 --- a/linux-2.4.26-xen-sparse/arch/xen/Makefile +++ b/linux-2.4.26-xen-sparse/arch/xen/Makefile @@ -16,15 +16,11 @@ # Added '-march' and '-mpreferred-stack-boundary' support # -override EXTRAVERSION := $(subst linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL),,$(shell basename $(TOPDIR)))$(EXTRAVERSION) +override EXTRAVERSION:=$(subst linux-$(VERSION).$(PATCHLEVEL).$(SUBLEVEL),,$(shell basename $(TOPDIR)))$(EXTRAVERSION) -# This following is pretty horrid, but I think the ends justify the -# means: if no .config file exists copy the appropriate defconfig-XXX -# file to .config so that we use it in preference to the plain -# defconfig file. It would be much better if there was a hook in the -# main Makefile to do this, but this works. +# If no .config file exists then use the appropriate defconfig-* file ifneq (.config,$(wildcard .config)) -X=$(shell cp arch/xen/defconfig$(EXTRAVERSION) .config) +X:=$(shell cp arch/xen/defconfig$(EXTRAVERSION) .config 2>/dev/null) -include .config endif -- 2.30.2